<script src="auth.js"></script>
<template>
    <div class="wrapper" @click="update">
        <image :src="logoUrl" class="logo"></image>
        <text class="title">Hello {{count}}</text>
        <!-- v-model -->
        <div class="test">
            <text>{{ msg }}</text>
            <input v-model="msg"/>
        </div>
    </div>

</template>

<style>
    .wrapper {
        align-items: center;
        margin-top: 120px;
    }

    .title {
        font-size: 48px;
    }

    .logo {
        width: 360px;
        height: 82px;
    }
</style>

<script>
    var modal = weex.requireModule('modal');
    var eventModule = weex.requireModule('event');  // 自定义模块
    var navigator = weex.requireModule('navigator');

    export default {
        props: {
            id: {
                type: [Number, String],
                required: true,
                default: '13230551'
            },
            msg: {
                type: String,
                default: 'this is a msg'
            }
        },
        data() {
            return {
                logoUrl: 'https://alibaba.github.io/weex/img/weex_logo_blue@3x.png',
                target: 'World',
                message: 'shop'
            }
        },
        computed: {
            count () {
                return this.$store.state.count
            }
        },
        methods: {
            increment () {
                this.$store.commit('increment', {amount: 10})
//                this.$store.dispatch('incrementAsync', {amount: 10})
                console.log(this.$store.getters.getCurrentCount)
            },
            update: function (e) {
                this.target = 'Weex';

//
                var _this = this;

                var bundleUrl = this.$getConfig().bundleUrl;
                console.log(bundleUrl);
                var params = {
                    url: 'http://172.20.12.21:8080/dist/' + this.msg + '.weex.js',
//                    url: bundleUrl,
                    animated: 'true',
                };
                navigator.push(params, function (e) {
                    console.log(e);
//                    _this.$router.push('game');
                });

//              eventModule.openURL({key: 'this is a test msg'}, function (ret) {
//                  // nativeLog(ret);
//                  modal.alert({
//                      message: ret.result,
//                      duration: 0.2
//                  }, function (value) {
//                      console.log('alert callback')
//                  })
//              });
            }
        }
    };


</script>
